package com.dgw.springbootrabbitmq.config;



import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {
    //绑定监听的队列key
    public static final String DIRECT_QUEUE = "direct.queue";
    @Bean
    public Queue directQueue() {
        /**
         * 1.队列名
         * 2.durable持久化消息队列，rabbitmq童后的时候不需要创建新的队列默认true
         * 3.auto-delete 表示浏感队列没有在使用时海被自动删除新认是false
         * 4.exclusive 表示该浏息队列是否只在当iconnection生效，新认是false
         */
        return new Queue("direct.queue", true);
    }

   /* @Bean
    public SimpleMessageListenerContainer simpleMessageListenerContainer(){
        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory());
        container.setMessageConverter(new Jackson2JsonMessageConverter());
        // 默认采用下面的这种转换器
        // container.setMessageConverter(new SimpleMessageConverter());
        return container;
    }*/
}
